﻿<!DOCTYPE html>
<html lang="zh">

<head resource>
    <meta charset="utf-8">
    <include file="../inc/meta.inc" />
    <title>新闻管理</title>
</head>

<body>
    <div id="vapp" v-cloak>

        <div class="left_box" remark="新闻栏目">
            <div class="toolsbar" @click="curr_column = null">
                <span>
                    <icon>&#xe6fd</icon>
                    新闻栏目
                    <span class="tip">(点击此处选所有)</span>
                </span>
            </div>
            <div class="treebox">
                <el-tree :data="columns" v-loading="loading_init" :props="defaultProps" default-expand-all
                    @node-click="data=>curr_column = data" :expand-on-click-node="false">
                    <span class="custom-tree-node" slot-scope="{ node, data }">
                        <span class="bolder" v-if="curr_column && curr_column.Col_ID==data.Col_ID"
                            v-html="data.Col_Name"></span>
                        <span v-else v-html="data.Col_Name"></span>
                        <article_count :column="data" :orgid="organ.Org_ID"></article_count>
                    </span>
                </el-tree>
            </div>
        </div>
        <div class="right_box" remark="新闻列表">
            <div class="toolsbar" v-if="!loading_init">
                <btngroup show="新增,修改,删除" ref='btngroup' @delete="deleteData" path="Modify" width="820" height="600"
                    :selects='selects' idkey='Art_ID' table="datatables"></btngroup>
                <query_panel :model="form" :loading="loading" @search="handleCurrentChange(1)">
                    <el-form-item label="">
                        <el-input v-model="form.search" clearable style="width:100px"></el-input>
                    </el-form-item>
                </query_panel>
            </div>
            <el-table ref="datatables" :data="datas" tooltip-effect="dark" style="width: 100%" v-loading="loading"
                @selection-change="val=>selects=val"
                @row-dblclick="row=>$refs.btngroup.modify(row[$refs.btngroup.idkey])" row-key="Art_ID"
                :row-class-name="data=>{return data.row.Art_IsUse ? 'enable' : 'disabled';}">
                <el-table-column type="selection" width="35" show-overflow-tooltip>
                </el-table-column>
                <el-table-column type="index" width="50" align="center">
                    <template slot-scope="scope">
                        <span>{{(form.index - 1) * form.size + scope.$index + 1}}</span>
                    </template>
                </el-table-column>

                <el-table-column label="标题" min-width="300px">
                    <template slot-scope="scope">
                        <icon v-if="scope.row.Art_IsTop" class="top" title="置顶">&#xe618</icon>
                        <icon v-if="scope.row.Art_IsImg" title="图片" style="font-size: 18px;">&#xe672</icon>

                        <a :href="'/web/news/article.'+scope.row.Art_ID" target="_blank"
                            v-html="showsearch(scope.row.Art_Title,form.search)" class="large link"></a>
                    </template>
                </el-table-column>

                <el-table-column label="启用" width="60">
                    <template slot-scope="scope">
                        <span class="el-icon-loading" v-show="loadingid==scope.row.Art_ID"></span>
                        <div>
                            <el-switch v-model="scope.row.Art_IsUse" @change="changeState(scope.row)"
                                active-color="#13ce66" inactive-color="#ff4949" v-show="loadingid!=scope.row.Art_ID">
                            </el-switch>
                        </div>
                    </template>
                </el-table-column>
                <el-table-column label="操作" show-overflow-tooltip width="80">
                    <template slot-scope="scope">

                        <el-dropdown>
                            <span class="el-dropdown-link">
                                <icon>&#xe64d</icon><span style="font-size: 12px">编辑</span><i
                                    class="el-icon-arrow-down el-icon--right"></i>
                            </span>
                            <el-dropdown-menu slot="dropdown">
                                <el-dropdown-item>
                                    <el-link type="success" plain @click='btnsettop(scope.row)'>
                                        <template v-if="!scope.row.Art_IsTop">
                                            <icon>&#xe618</icon> 置顶
                                        </template>
                                        <template v-else>
                                            <icon>&#xe618</icon> 取消置顶
                                        </template>
                                    </el-link>
                                </el-dropdown-item>
                                <el-dropdown-item divided>
                                    <el-link type="primary" plain icon="el-icon-edit"
                                        @click='$refs.btngroup.modify(scope.row.Art_ID)'>
                                        修改
                                    </el-link>
                                </el-dropdown-item>
                                <el-dropdown-item>
                                    <el-popconfirm confirm-button-text='是的' cancel-button-text='不用' icon="el-icon-info"
                                        icon-color="red" title="确定删除吗？"
                                        @confirm="$refs.btngroup.delete(scope.row.Art_ID)">
                                        <el-link type="danger" plain icon="el-icon-delete" slot="reference">删除
                                        </el-link>
                                    </el-popconfirm>
                                </el-dropdown-item>
                            </el-dropdown-menu>
                        </el-dropdown>

                    </template>

            </el-table>
            <div id="pager-box">
                <el-pagination v-on:current-change="handleCurrentChange" :current-page="form.index" :page-sizes="[1]"
                    :page-size="form.size" :pager-count="12" layout="total, prev, pager, next, jumper" :total="total">
                </el-pagination>
            </div>
        </div>

    </div>
</body>

</html>